package cn.theten52.demo.patterns.design.behavior.interpreter;

import java.util.Map;

/**
 * 减法
 *
 * @author wangjin
 * @date 2021/1/6
 */
public class Minus extends SymbolExp {
    public Minus(Expression left, Expression right) {
        super(left, right);
    }

    @Override
    public double interpreter(Map<String, Double> var) {
        // 返回左右两个表达式之差
        return left.interpreter(var) - right.interpreter(var);
    }
}
